var units = require('../db')
var express = require('express')
var router = express.Router()

// 查询
router.post('/search', (req, res) => {
    units.sql('select * from dbo.test_dim_item', function(err, result) {
        let msg = ''
        let code = -1
        if (err) {
            msg = err
            code = -1
        } else {
            msg = '成功'
            code = 0
        }
        // console.log('data :', result)
        res.json({
            code: code,
            data: result.recordset,
            msg: msg
        })
    })
})
module.exports = router